
#@layout()
#define css()
#@layout_css?()
<link rel="stylesheet" href="#(CPATH)/static/components/datepicker/css/bootstrap-datepicker3.min.css">
<link rel="stylesheet" href="#(CPATH)/static/components/jquery-file-upload/css/jquery.fileupload.css">
<style>
    #uploader {
        height: 230px;
    }
    .myPanel {
        font-size: 25px;
        color: #ccc;
        text-align: center;
        padding-top: 60px;
    }
</style>
#end
#define script()
<script src="#(CPATH)/static/components/ckeditor/ckeditor.js"></script>
<script src="#(CPATH)/static/components/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
<script src="#(CPATH)/static/components/jquery-file-upload/js/jquery.iframe-transport.js"></script>
<script src="#(CPATH)/static/components/jquery-file-upload/js/jquery.fileupload.js"></script>
#@layout_script?()
<script src="#(CPATH)/static/components/datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="#(CPATH)/static/components/datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script>
    $("input[hint='date']").datepicker({
        format: 'yyyy-mm-dd',
        language: 'zh-CN'
    });

  function doSubmit() {
    ajaxSubmit("#form", function (data) {
        $("#entryId").attr("value", data.id);
        toastr.success('内容保存成功。');
        location.href="/admin/partnershipauthorities/jpress_addon_partnershipauthorities";
    })
  }

    $("#submit").on("click", function () {
        doSubmit();
    })

    initEditor('editor1', 267,"html");
    initEditor('editor2', 267,"html");
    initEditor('editor3', 267,"html");
    initEditor('editor4', 267,"html");

    $("#attachments-1").hide()

    </script>
<script>
    $('#cfile').fileupload({
        dropZone: $('#uploader'),
        url: '#(CPATH)/commons/attachment/upload',
        sequentialUploads: true,
        progressall: function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $(".myPanel").text("上传进度：" + progress + "%")
        },
        done: function (e, data) {

            $(".myPanel").text("或者拖动文件到这里进行上传...");

            if(data.result.state == "ok"){
                $("#attachment").val(data.result.src);
                toastr.success("文件上传成功...")
                $("#attachments-1").show();
                $("#attachments-1-a").attr("href",data.result.src);
            }else {
                toastr.error(data.result.message)
            }
        }
    });

</script>
#end


#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>
                        编辑/新增
            <small>Edit</small>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header ">
                        <h3 class="box-title"></h3>
                    </div>
                    <form class="form-horizontal form-setting" autocomplete="off"
                          action="/admin/partnershipauthorities/jpress_addon_partnershipauthorities/doSave"
                          method="POST" id="form">

                        <div class="box-body ">
	                                <input type="hidden" id="entryId" name="jpressAddonPartnershipauthorities.id" value="#(jpressAddonPartnershipauthorities.id ??)">
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">中文国家名称</label>
		                                <div class="col-sm-6">

										   <input type="input" name="jpressAddonPartnershipauthorities.country_name_ch" class="form-control" value="#(jpressAddonPartnershipauthorities.country_name_ch ??)"
		                                           placeholder="">
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">英文国家名称</label>
		                                <div class="col-sm-6">

										   <input type="input" name="jpressAddonPartnershipauthorities.country_name_en" class="form-control" value="#(jpressAddonPartnershipauthorities.country_name_en ??)"
		                                           placeholder="">
		                                </div>
		                            </div>
                                    <div class="form-group" id="attachments-1">
                                        <label class="col-sm-2 control-label">已上传</label>
                                        <div class="col-sm-6">
                                            <a href="" id="attachments-1-a">下载附件</a>
                                        </div>
                                    </div>
                                    #if(jpressAddonPartnershipauthorities.image ??)
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">历史图标</label>
                                        <div class="col-sm-6">
                                            <img src="#(jpressAddonPartnershipauthorities.image ??)"/>
                                        </div>
                                    </div>
                                    #end
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">图标</label>
                                        <div class="col-sm-6">
                                            <input id="attachment" type="hidden" name="jpressAddonPartnershipauthorities.image" value="#(jpressAddonPartnershipauthorities.image ??)"/>
                                            <div id="uploader">
                                                                <span class="btn btn-block btn-primary fileinput-button" style="width: 120px">
                                                                    <i class="glyphicon glyphicon-plus"></i>
                                                                    <span>选择文件...</span>
                                                                    <input id="cfile" type="file" name="files[]" multiple>
                                                                </span>
                                                <div class="myPanel">
                                                    或者拖动文件到这里进行上传...
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">机构介绍简介</label>
                                        <div class="col-sm-8" style="z-index: 9999;">
                                            <textarea class="form-control"
                                                      name="jpressAddonPartnershipauthorities.content_simple">#EditorContent(jpressAddonPartnershipauthorities.content_simple ??)</textarea>
                                        </div>
                                    </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">机构介绍</label>
                                        <div class="col-sm-8" style="z-index: 9999;">
                                            <textarea id="editor1" name="jpressAddonPartnershipauthorities.content"
                                          style="height: 467px;width: 100%;background-color: white">#EditorContent(jpressAddonPartnershipauthorities.content ??)</textarea>
                                        </div>
		                            </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">机构介绍简介英文</label>
                                        <div class="col-sm-8" style="z-index: 9999;">
                                                    <textarea class="form-control"
                                                              name="jpressAddonPartnershipauthorities.content_simple_en">#EditorContent(jpressAddonPartnershipauthorities.content_simple_en ??)</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">英文机构介绍</label>
                                        <div class="col-sm-8" style="z-index: 9999;">
                                                    <textarea id="editor2" name="jpressAddonPartnershipauthorities.content_en"
                                                              style="height: 467px;width: 100%;background-color: white">#EditorContent(jpressAddonPartnershipauthorities.content_en ??)</textarea>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系方式简介</label>
                                        <div class="col-sm-8" style="z-index: 9999;">
                                                            <textarea class="form-control"
                                                                      name="jpressAddonPartnershipauthorities.contact_information_simple">#EditorContent(jpressAddonPartnershipauthorities.contact_information_simple ??)</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系方式</label>
                                        <div class="col-sm-8" style="z-index: 9999;">
                                                    <textarea id="editor3" name="jpressAddonPartnershipauthorities.contact_information"
                                                              style="height: 467px;width: 100%;background-color: white">#EditorContent(jpressAddonPartnershipauthorities.contact_information ??)</textarea>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系方式简介英文</label>
                                        <div class="col-sm-8" style="z-index: 9999;">
                                                                    <textarea class="form-control"
                                                                              name="jpressAddonPartnershipauthorities.contact_information_simple_en">#EditorContent(jpressAddonPartnershipauthorities.contact_information_simple_en ??)</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">英文联系方式</label>
                                        <div class="col-sm-8" style="z-index: 9999;">
                                                            <textarea id="editor4" name="jpressAddonPartnershipauthorities.contact_information_en"
                                                                      style="height: 467px;width: 100%;background-color: white">#EditorContent(jpressAddonPartnershipauthorities.contact_information_en ??)</textarea>
                                        </div>

                                    </div>

                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <div class="col-sm-offset-2 col-sm-10 submit-block">
                                <div class="box-submit">
                                    <button id="submit" type="button" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
        </div>

    </section>

</div>
#end
